﻿using SafoverWpfFw;
using System;
using System.Collections.Generic;
using System.Globalization;
using Safover.Lidar.DataContract;

namespace Safover.LidarCollector.Converter
{
    public class LidarWorkModesToStringArrayConverter : BaseValueConverter<LidarWorkModesToStringArrayConverter>
    {
        public override object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            return DoConvert(value);
        }

        public override object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
        {
            throw new NotImplementedException();
        }

        private object DoConvert(object value)
        {
            LidarWorkMode[] lidarWorkModes = (value as LidarWorkMode[]);
            var strs = new List<string>();

            foreach (var lidarWorkMode in lidarWorkModes)
            {
                switch (lidarWorkMode)
                {
                    case LidarWorkMode.Fixed:
                        strs.Add("定向");
                        break;
                    case LidarWorkMode.Horizontal:
                        strs.Add("锥面");
                        break;
                    case LidarWorkMode.Vertical:
                        strs.Add("剖面");
                        break;
                    case LidarWorkMode.Underway:
                        strs.Add("走航");
                        break;
                    case LidarWorkMode.Multi:
                        strs.Add("多模式");
                        break;
                    default:
                        break;
                }
            }
            

            return strs.ToArray();
        }

    }
}
